<% content_for :title do %>Gebruikers<% end %>
<%form_tag(admin_users_path, :method => :get) do %>
<table>
	<tr>
		<td>Gebruikersnaam:</td>
		<td>Voornaam:</td>
		<td>Achternaam:</td>
	</tr>
	<tr>
		<td><%= text_field_tag :user,@user%></td>
		<td><%= text_field_tag :first_name,@first_name%></td>
		<td><%= text_field_tag :surname,@surname%></td>
	</tr>
	<tr>
		<td>Plaats:</td>
		<td>Postcode en huisnummer:</td>
		<td>Email adres:</td>
	</tr>
	<tr>
		<td><%= text_field_tag :city,@city%></td>
		<td><%= text_field_tag :postal_code, @postal_code, :size => 6, :maxlength => 6%><%=text_field_tag :house_number, @house_number, :size => 4, :maxlength => 4%></td>
		<td><%= text_field_tag :email,@email%></td>
	</tr>
	<tr>
		<td colspan=2>Account aangemaakt vanaf:</td>
		<td colspan=2>Account aangemaakt tot:</td>
	</tr>
	<tr>
		<td colspan=1><%=select_date @date_from, :prefix => :from, :start_year => 2000, :end_year => Time.now.year, :include_blank => true%></td>
		<td colspan=1><%=select_date @date_to, :prefix => :to, :start_year => 2000, :end_year => Time.now.year, :include_blank => true%></td>
		<td><%=submit_tag 'Zoek'%></td>
	</tr>
</table>
<%end%>
<table>
<%if (@accounts.size > 0)%>
	<tr>
		<%sort = @params[:sort]%>
		<%sort_on = @params[:sort_on]%>
		<th align="left">Gebruikersnaam:<%= link_to image_tag("asc.gif"), admin_users_path(@params, @params[:sort] = 'ASC', @params[:sort_on] = 'users.name')%><%= link_to image_tag("desc.gif"), admin_users_path(@params, @params[:sort] = 'DESC', @params[:sort_on] = 'users.name')%></td>
		<th align="left">Email adres:<%= link_to image_tag("asc.gif"), admin_users_path(@params, @params[:sort] = 'ASC', @params[:sort_on] = 'users.email')%><%= link_to image_tag("desc.gif"), admin_users_path(@params, @params[:sort] = 'DESC', @params[:sort_on] = 'users.email')%></td>
		<th align="left">Account aangemaakt op:<%= link_to image_tag("asc.gif"), admin_users_path(@params, @params[:sort] = 'ASC', @params[:sort_on] = 'users.created_at')%><%= link_to image_tag("desc.gif"), admin_users_path(@params, @params[:sort] = 'DESC', @params[:sort_on] = 'users.created_at')%></td>
		<th align="left">Is admin:<%= link_to image_tag("asc.gif"), admin_users_path(@params, @params[:sort] = 'ASC', @params[:sort_on] = 'users.is_admin')%><%= link_to image_tag("desc.gif"), admin_users_path(@params, @params[:sort] = 'DESC', @params[:sort_on] = 'users.is_admin')%></td>
		<th></th>
		<%@params[:sort] = sort%>
		<%@params[:sort_on] = sort_on%>
	</tr>
<%end%>
<% @accounts.each do |user|%>
	<%= render :partial => 'user_admin', :locals => {:user => user}%>
<%end%>
</table>
<p>
<% if @indices[0] > -1 then%>
	<%= link_to 'vorige', admin_users_path(@params, @params[:page] = @indices[0])%>
<%end%>
<% if @indices[1] != nil then%>
	<%= link_to 'volgende', admin_users_path(@params, @params[:page] = @indices[1])%>
<%end%>
</p>